
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

int main(int argc, char *argv[])
{
	if((argc==3) && (strcmp(argv[1],argv[2])!=0))
	{
		int fd_src,fd_dest,ret;

		fd_src=open(argv[1],O_RDONLY);
		if(fd_src < 0){
			perror("open argv[1]");
			return -1;
		}
		fd_dest=open(argv[2],O_WRONLY | O_CREAT,0755);

		if(fd_dest < 0){
			perror("open argv[1]");
			return -1;
		}
	
	do{
		char buf[1024]={0};

		ret=read(fd_src,buf,sizeof(buf));
		write(fd_dest,buf,ret);
	}while(ret>0);
	close(fd_src);
	close(fd_dest);
	}
	return 0;

}








